var order = ['red', 'yellow', 'blue', 'green', 'red']
Page({

  /**
   * 页面的初始数据
   */
  data: {
    t1: true,
    t2: false,
    t3: false,
    t4: false,
    movies: [
      { url: 'http://img04.tooopen.com/images/20130712/tooopen_17270713.jpg' },
      { url: 'http://img04.tooopen.com/images/20130617/tooopen_21241404.jpg' },
      { url: 'http://img04.tooopen.com/images/20130701/tooopen_20083555.jpg' },
      { url: 'http://img02.tooopen.com/images/20141231/sy_78327074576.jpg' }
    ],
    toView: 'red',
    scrollTop: 100
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  titbtn1: function () {
    wx.vibrateShort()
    this.setData({
      t1: true,
      t2: false,
      t3: false,
      t4: false
    })
      
  },
  titbtn2: function () {
    wx.vibrateShort()
    this.setData({
      t1: false,
      t2: true,
      t3: false,
      t4: false
    })
  },
  titbtn3: function () {
    wx.vibrateShort()
    this.setData({
      t1: false,
      t2: false,
      t3: true,
      t4: false
    })
  },
  titbtn4: function () {
    wx.vibrateShort()
    this.setData({
      t1: false,
      t2: false,
      t3: false,
      t4: true
    })
  },
  can: function () {
    wx.scanCode({
      success: (res) => {
        console.log(res)
      }
    })
  },
  upper: function (e) {
    console.log(e)
  },
  lower: function (e) {
    console.log(e)
  },
  scroll: function (e) {
    console.log(e)
  },
  tap: function (e) {
    for (var i = 0; i < order.length; ++i) {
      if (order[i] === this.data.toView) {
        this.setData({
          toView: order[i + 1]
        })
        break
      }
    }
  },
  tapMove: function (e) {
    this.setData({
      scrollTop: this.data.scrollTop + 10
    })
  },
  user: function () {
    wx.navigateTo({
      url: '../users/users',
    })
  },
  navs:function(){
    wx.navigateTo({
      url: '../orders/orders',
    })
  }
})